package draw

import "vrcm/src/vrcm/common/models"

type DrawBasic struct {
	models.Model

	TenantId     string        `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	BindId       string        `json:"bind_id" gorm:"type:varchar(300);comment:域名配置id"`
	Animation    string        `json:"animation" gorm:"type:varchar(500);comment:动画"`
	DrawTitle    string        `json:"draw_title" gorm:"type:varchar(100);comment:抽奖标题"`
	DrawState    int           `json:"draw_state" gorm:"type:tinyint;comment:抽奖状态 1 推送 2未推送 3结束"`
	IsRepeat     int           `json:"is_repeat" gorm:"type:tinyint;comment:是否重复抽奖 1是 2 否"`
	Round        int           `json:"round" gorm:"type:int;comment:场次"`
	SecretNum    string        `json:"secret_num" gorm:"type:varchar(100);comment:私信号码"`
	QRCode       string        `json:"qr_code" gorm:"type:varchar(300);comment:二维码"`
	Tip          string        `json:"tip" gorm:"type:varchar(500);comment:提示"`
	JoinType     int           `json:"join_type" gorm:"type:tinyint;comment:参与类型 1全体参与者 2白名单"`
	AwardNum     int           `json:"award_num" gorm:"-"`
	AwardUserNum int           `json:"award_user_num" gorm:"-"`
	ClaimPrize   ClaimPrize    `json:"claim_prize" gorm:"-"`
	PrizeConfigs []PrizeConfig `json:"prize_configs" gorm:"-"`
	DrawWhites   []DrawWhite   `json:"draw_whites" gorm:"-"`
	models.ModelTime
	models.ControlBy
}

func (DrawBasic) TableName() string {
	return "draw_basic"
}

type ClaimPrize struct {
	models.Model

	TenantId  string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DrawId    int    `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	PrizeType int    `json:"prize_type" gorm:"type:tinyint;comment:领奖方式 1寄送奖品 2私信兑换 3 无需领奖"`
	models.ModelTime
	models.ControlBy
}

type DrawInfo struct {
	DrawId    int `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	DrawState int `json:"draw_state" gorm:"type:int;comment:抽奖状态"`
}

func (ClaimPrize) TableName() string {
	return "claim_prize"
}

type PrizeConfig struct {
	models.Model

	TenantId  string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DrawId    int    `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	PrizeName string `json:"prize_name" gorm:"type:varchar(100);comment:奖品名"`
	PrizeImg  string `json:"prize_img" gorm:"type:varchar(500);comment:奖品图片"`
	PrizeNum  int    `json:"prize_num" gorm:"type:int;comment:奖品数量"`
	models.ModelTime
	models.ControlBy
}

type PrizeResult struct {
	DrawID   int `json:"draw_id"`
	PrizeNum int `json:"prize_num"`
}

func (PrizeConfig) TableName() string {
	return "prize_config"
}

type DrawUser struct {
	models.Model

	TenantId    string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DrawId      int    `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	UserName    string `json:"user_name" gorm:"type:varchar(100);comment:抽奖用户"`
	MobilePhone string `json:"mobile_phone" gorm:"type:varchar(100);comment:手机号"`
	Address     string `json:"address" gorm:"type:varchar(500);comment:手机地址"`
	Round       int    `json:"round" gorm:"type:int;comment:场次"`
	models.ModelTime
	models.ControlBy
}

func (DrawUser) TableName() string {
	return "draw_user"
}

type AwardRecord struct {
	models.Model

	TenantId    string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DrawId      int    `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	PrizeId     int    `json:"prize_id" gorm:"type:bigint unsigned;comment:奖项id"`
	AwardUserId int    `json:"award_user_id" gorm:"type:bigint unsigned;comment:中奖用户id"`
	DrawTitle   string `json:"draw_title" gorm:"type:varchar(100);comment:抽奖标题"`
	UserName    string `json:"user_name" gorm:"type:varchar(100);comment:中奖用户"`
	PrizeName   string `json:"prize_name" gorm:"type:varchar(100);comment:奖品名称"`
	MobilePhone string `json:"mobile_phone" gorm:"type:varchar(100);comment:手机号"`
	Address     string `json:"address" gorm:"type:varchar(500);comment:地址"`
	WriteState  int    `json:"write_state" gorm:"type:tinyint;comment:填写状态 1填写 2未填写"`
	models.ModelTime
	models.ControlBy
}

type Record struct {
	DrawID    int `json:"draw_id"`
	RecordNum int `json:"record_num"`
}

func (AwardRecord) TableName() string {
	return "award_record"
}

type UserAwardInfo struct {
	DrawId     int    `json:"draw_id" comment:"抽奖配置id"`
	DrawTitle  string `json:"draw_title" comment:"抽奖标题"`
	AwardState string `json:"award_state" comment:"抽奖状态 "`
	WriteState int    `json:"write_state" comment:"1填写 2 未填写"`
}

type DrawWhite struct {
	models.Model

	TenantId     string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DrawId       int    `json:"draw_id" gorm:"type:bigint unsigned;comment:抽奖配置id"`
	PrizeId      int    `json:"prize_id" gorm:"type:bigint unsigned;comment:奖项id"`
	JoinType     int    `json:"join_type" gorm:"type:tinyint;comment:参与类型 1全体参与者 2白名单"`
	IsSelect     int    `json:"is_select" gorm:"type: tinyint;comment:是否必中 1是 2否"`
	PhoneOrEmail string `json:"phone_or_email" gorm:"type:varchar(300);comment:用户手机或邮箱"`
	models.ModelTime
	models.ControlBy
}

func (DrawWhite) TableName() string {
	return "draw_white"
}
